import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';


class TopNavigator extends StatelessWidget {
  final List navigatorList;

  TopNavigator( this.navigatorList);

  Widget _getNavigator(context,item){
    return InkWell(
      onTap: (){print('点击了第${item}个栏目');},
      child: Column(
        children: <Widget>[
          Image.network(item['item_url'],fit: BoxFit.fill,),
          Text(item['item_title'])
        ],
      ),

    );
  }
  @override
  Widget build(BuildContext context) {
    return Container(
      height: ScreenUtil().setHeight(320),
      padding:EdgeInsets.all(3.0),
      child: GridView.count(
        crossAxisCount: 4,
        padding: EdgeInsets.all(4),
        children: navigatorList.map((item){
          return _getNavigator(context, item);
        }).toList(),
      ),
    );
  }
}
